{{include "../layout_header.html"}}
<link rel="stylesheet" type="text/css" href="/public/css/xm/login.css">
<style type="text/css">
	body {
		background-color: transparent !important;
	}
</style>
<!-- login -->
<div class="top center">
	<div class="logo center">
		<a href="./index.html" target="_blank"><img src="/public/img/logo.png" alt=""></a>
	</div>
</div>
<div class="formBox">
	<form id="loginForm" method="post" action="/customerInfo/checkLogin?_csrf={{csrf}}" class="form center">
		<div class="login">
			<div class="login_center">
				<div class="login_top">
					<div class="left fl">会员登录</div>
					<div class="right fr">您还不是我们的会员？<a href="/customerInfo/register" target="_self">立即注册</a></div>
					<div class="clear"></div>
					<div class="xian center"></div>
				</div>
				<div class="login_main center">
					<div class="username">用户名:&nbsp;
						<input class="shurukuang" type="text" name="customername" placeholder="用户名/手机号/邮箱"
							data-rule-required="true" />
					</div>
					<div></div>
					<div class="username">密&nbsp;&nbsp;&nbsp;&nbsp;码:&nbsp;
						<input class="shurukuang" type="password" name="customerpwd" placeholder="请输入你的密码"
							data-rule-required="true" />
					</div>
					<div></div>
					<div class="username">
						<div class="left fl">验证码:&nbsp;
							<input class="yanzhengma" type="text" id="VCode" placeholder="请输入验证码" />
						</div>
						<div class="right fl"><img style="height: 35px;" id="VCodeImg" src="/customerInfo/getVCode?">
						</div>
						<div class="clear"></div>
					</div>
				</div>
				<div class="login_submit">
					<input class="submit" type="submit" id="btnLogin" value="立即登录">
				</div>

			</div>
		</div>
	</form>
</div>

<footer>
	<div class="copyright">简体 | 繁体 | English | 常见问题</div>
	<div class="copyright">Softeem·杨标版权所有<img src="/public/img/ghs.png" alt=""></div>

</footer>
<script type="text/javascript">
	$(function () {
		$("#loginForm").validate({
			errorPlacement: function (err, element) {
				err.appendTo(element.parent().next());
			},
			errorClass:"error-text"
		});

		//点击刷新验证码
		$("#VCodeImg").click(function () {
			var src = $(this).attr("src");
			// 在请求地址的后面加上一个随机数，这样每次请求的SRC都不一样，这样img就会重新发起请求
			// 重新发起请求就相当于重新获取验证码
			$(this).attr("src", src.replace(/\?.*/g, "?" + Math.random()));
		});


		$("#btnLogin").click(function () {
			//检测验证码是否正确
			var flag = false;
			var vcode = $("#VCode").val();
			if (vcode) {
				$.ajax({
					async: false,
					url: "/customerInfo/checkVCode/" + vcode,
					success: function (data) {
						if (data == true) {
							flag = true;
						} else {
							layer.alert("验证码错误，请重试");
							$("#VCodeImg").click();
						}
					}
				});
			}
			else{
				layer.alert("请输入验证码");
			}
			return flag;

		});
	})
</script>
{{include '../layout_footer.html'}}